Quản lý website giới thiệu và bán điện thoại di động ASP.net
19.277 lượt xem;
- dangkythanhcong.aspx.cs
- project /
1 using System;
2 using System.Collections;
3 using System.Configuration;
4 using System.Data;
5 using System.Linq;
6 using System.Web;
7 using System.Web.Security;
8 using System.Web.UI;
9 using System.Web.UI.HtmlControls;
10 using System.Web.UI.WebControls;
11 using System.Web.UI.WebControls.WebParts;
12 using System.Xml.Linq;
13 using System.Data.OleDb;
14
15 public partial class dangkythanhcong : System.Web.UI.Page
16 {
17 protected void Page_Load(object sender, EventArgs e)
18 {
19
20
21 }
22 protected void btndangnhap_Click(object sender, EventArgs e)
23 {
24 if (txtemail.Text != "")
25 {
26 if (txtpass.Text != "")
27 {
28 ado.ketNoi();
29 string query = "select * from tbluser where email='" + txtemail.Text + "' and matkhau='" + txtpass.Text + "'";
30 ado.rd = ado.getData(query);
31 if (ado.rd.Read())
32 {
33 FormsAuthentication.SetAuthCookie(txtemail.Text, true);
34 Session["email"] = txtemail.Text;
35 Session["matkhau"] = ado.rd[1].ToString();
36 Session["quyen"] = ado.rd[2].ToString();
37 Session["hoten"] = ado.rd[3].ToString();
38 Session["diachi"] = ado.rd[4].ToString();
39 Session["dienthoai"] = ado.rd[5].ToString();
40 Session["soCMND"] = ado.rd[6].ToString();
41 Session["mataikhoan"] = ado.rd[7].ToString();
42
43 if (Session["quyen"].ToString() == "admin")
44 Response.Redirect("themqtri.aspx");
45 else
46 Response.Redirect("thongtintaikhoan.aspx", true);
47 }
48 else
49 {
50 txtemail.Focus();
51 }
52
53 ado.rd.Dispose();
54 ado.dongKetNoi();
55 }
56 else Label2.Text = "Bạn chưa nhập mật khẩu";
57 }
58 else Label2.Text = "Bạn chưa nhập Email";
59 }
60 }
2 using System.Collections;
3 using System.Configuration;
4 using System.Data;
5 using System.Linq;
6 using System.Web;
7 using System.Web.Security;
8 using System.Web.UI;
9 using System.Web.UI.HtmlControls;
10 using System.Web.UI.WebControls;
11 using System.Web.UI.WebControls.WebParts;
12 using System.Xml.Linq;
13 using System.Data.OleDb;
14
15 public partial class dangkythanhcong : System.Web.UI.Page
16 {
17 protected void Page_Load(object sender, EventArgs e)
18 {
19
20
21 }
22 protected void btndangnhap_Click(object sender, EventArgs e)
23 {
24 if (txtemail.Text != "")
25 {
26 if (txtpass.Text != "")
27 {
28 ado.ketNoi();
29 string query = "select * from tbluser where email='" + txtemail.Text + "' and matkhau='" + txtpass.Text + "'";
30 ado.rd = ado.getData(query);
31 if (ado.rd.Read())
32 {
33 FormsAuthentication.SetAuthCookie(txtemail.Text, true);
34 Session["email"] = txtemail.Text;
35 Session["matkhau"] = ado.rd[1].ToString();
36 Session["quyen"] = ado.rd[2].ToString();
37 Session["hoten"] = ado.rd[3].ToString();
38 Session["diachi"] = ado.rd[4].ToString();
39 Session["dienthoai"] = ado.rd[5].ToString();
40 Session["soCMND"] = ado.rd[6].ToString();
41 Session["mataikhoan"] = ado.rd[7].ToString();
42
43 if (Session["quyen"].ToString() == "admin")
44 Response.Redirect("themqtri.aspx");
45 else
46 Response.Redirect("thongtintaikhoan.aspx", true);
47 }
48 else
49 {
50 txtemail.Focus();
51 }
52
53 ado.rd.Dispose();
54 ado.dongKetNoi();
55 }
56 else Label2.Text = "Bạn chưa nhập mật khẩu";
57 }
58 else Label2.Text = "Bạn chưa nhập Email";
59 }
60 }